import numpy as np
# 向量与向量的乘积 创建向量
arr1 = np.arange(5)
arr2 = np.arange(5)
print(arr1) # [0 1 2 3 4]
print(arr2) # [0 1 2 3 4]
arr3 = np.dot(arr1,arr2)
print(arr3) # 30
print(type(arr3))


# 向量与矩阵的乘积 创建数组
arr1 = np.arange(5)
arr2 = np.arange(15).reshape(5,3)
print(arr1) # [0 1 2 3 4]
print(arr2)
"""
[[ 0  1  2]
 [ 3  4  5]
 [ 6  7  8]
 [ 9 10 11]
 [12 13 14]]
"""
arr3 = np.dot(arr1,arr2)
print(arr3) # [ 90 100 110]
print(type(arr3)) # <class 'numpy.ndarray'>

# 矩阵与向量的乘积
# 创建数组
arr1 = np.arange(15).reshape(3,5)
print(arr1)
"""
[[ 0  1  2  3  4]
 [ 5  6  7  8  9]
 [10 11 12 13 14]]
"""
arr2 = np.arange(5)
print(arr2) # [0 1 2 3 4]
# 矩阵乘积
arr3 = np.dot(arr1,arr2)
print(arr3) # [ 30  80 130]

# 4矩阵与矩阵的乘积
# 创建数组 1
arr1 = np.arange(10).reshape(5,2)
print(arr1)
"""
[[0 1]
 [2 3]
 [4 5]
 [6 7]
 [8 9]]
"""
# 创建数组 2
arr2 = np.arange(16).reshape(2,8)
print(arr2)
"""
[[ 0  1  2  3  4  5  6  7]
 [ 8  9 10 11 12 13 14 15]]
"""
# 矩阵乘积
print( np.dot(arr1,arr2) )
"""
[[  8   9  10  11  12  13  14  15]
 [ 24  29  34  39  44  49  54  59]
 [ 40  49  58  67  76  85  94 103]
 [ 56  69  82  95 108 121 134 147]
 [ 72  89 106 123 140 157 174 191]]
"""
